﻿/// <reference path="../_references.js" />
(function (e) {

    e.views = e.views || {};
    e.views.users = e.view.define({
        templateName: "tmpl_users",
        repo: null,
        load: function (state) {
            var that = this;
            this.repo = new e.repositories.users();
            this.repo.getAllUsers(function (err, data) {
                if (!err)
                    that.display(data);
            });
        },
        display: function (data) {
            var that = this;
            this.render({
                users: data,
                deleteUser: function () {
                    if (confirm(loc.deleteUserConfirm)) {
                        e.flash.info("Deleting users not supported yet.");
                    }
                }
            });
        }
    });

} (this.eg = this.eg || {}));